<?if ($catid && is_numeric($catid)){?>

	<!-- category tree -->
	<br/>
	<div class="main_cat1">
	<a href="search.php"><?=$sph_messages['Categories']?></a> >
	<?foreach ($cat_info['cat_tree'] as $_val){?>
		<a href="?catid=<?=$_val['category_id']?>"><?=$_val['category']?></a> >
	<? }?>
	</div>
	
	
	<!-- list of sub-categories -->
	<?if ($cat_info['subcats']){?>
		<div class="catBanner"><?=$sph_messages['Categories']?></div><br/>
		<?foreach ($cat_info['subcats'] as $_key => $_val){?>
			<a href="?catid=<?=$_val['category_id']?>"><b><?=$_val['category']?></b></a> (<?=$_val['count'][0][0]?>)<br>
		<? }?>
	<? }?>
		
		
	<!-- list of category web pages -->
	<?if ($cat_info['cat_sites']){?>
		<div class="webPageBanner"><?=$sph_messages['Web pages']?></div><br/>
		<?foreach ($cat_info['cat_sites'] as $_key => $_val){?>
			<b><?=$_key + 1?>.</b> <a href="<?=$_val['url']?>"><b><?=$_val['title']?></b></a><br><?=$_val['short_desc']?><br><font class="url"><?=$_val['url']?></font><br><br>
		<? }?>		
	<? }?>	 
<div class="divline">
</div>

<?} else {?>



	<!-- category selection -->
	<?if ($cat_info['main_list']){?>
	<center><br>
		<div id="cat_main">	
		<?=$sph_messages['CATEGORIES']?>
		</div>

		<table id="cat_table" border="0" cellpadding="4">
		<tr>
		<?foreach ($cat_info['main_list'] as $_key => $_val){
			$col_width=100/$cat_columns?>
			<td width="<?=$col_width?>%"> 
				<a href="?catid=<?=$_val['category_id']?>" class="main_cat1"><?=$_val['category']?></a><br>&nbsp;&nbsp;
				<?if (is_array($_val['sub'])) {
				foreach ($_val['sub'] as $__key => $__val){?>
					<!-- only 3 subcategories -->
					<?if ($__key > 2) break?>
					<a href="?catid=<?=$__val['category_id']?>" class="main_cat2"><?=$__val['category']?></a>
				<? }?>
				<?}?>
			</td>	
			<!-- column nr defined in config -->
			<?if (!(($_key +1)% $cat_columns)) {?></tr><tr><? }?>
		<? }?>
		</tr>
		</table>
	<? }?>
<? }?>

<div id="powered_by">
<!--If you want to remove this, please donate to the project--> 
<?poweredby()?> 
</div>

